var page = 1,limit=10;
var totalPage = 0;
var totalres=[];
window.addEventListener('onDropdown', function(event){
    console.log('下接刷新：' );

    if(page<totalPage){
        page++;

        loadData(this.page,this.limit);
    }else{
        // console.log(page)
         pop_up("最后一页")
    }
});
function loadData(ipage,ilimit) {
    server.req('wechat/order/list', {page: ipage, limit: ilimit,serviceType:4}, function (res) {
        totalres = totalres.concat(res.data);
        if (totalres)
            res.data = totalres;

        totalPage = res.totalPage;
        if (res.code == 0) {
            // console.log(res);
            if(res.data.length>0){
                $("#recharge_nodata").css("display","none");
            }
            res.data.forEach(function (item,index) {
                if(item.status==0){
                    res.data[index].strStatus="待支付";
                }else if(item.status==1){
                    res.data[index].strStatus="已付款";
                }

            })
            server.loadData(".container",res);
        }
    })
};
loadData(page,limit);